package com.hsp.enum_;

public class Enumeration {

    public static void main(String[] args) {
        System.out.println(Season.SPRING);
        System.out.println(Season.SUMMER);
        System.out.println(Season.AUTUMN);
        System.out.println(Season.WINTER);
    }

}


//1. 构造器私有化
//2. 本类内部创建一组对象
//3. 对外暴露对象(通过为对象添加public final static修饰符)
//4. 可以提供get 方法 不提供set，防止被修改

class Season {

    private String name; private String desc;//描述
    private Season(String name, String desc) {
        this.name = name;
        this.desc = desc;
    }

    public String getName() {
        return name;
    }

    public String getDesc() {
        return desc;
    }

    public static final Season SPRING = new Season("春天", "温暖");
    public static final Season SUMMER = new Season("夏天", "炎热");
    public static final Season AUTUMN = new Season("秋天", "凉爽");
    public static final Season WINTER = new Season("冬天", "寒冷");

    @Override
    public String toString() {
        return "name=" + this.name + " desc" + this.desc;
    }

}